package com.informa.unitils.datasetfactories.valuemappers;

import static com.informa.java.util.CollectionUtils.asList;

import java.util.List;

import static com.informa.utils.IOUtils.*;

public class LocationBytesMapper implements ValueMapper {
	
	private static final List<String> LOCATION_SOURCES = asList("url:","file:","classpath:","classpath*:");
	
	public boolean handles(String location) {
		
		for(String locationSource : LOCATION_SOURCES) {
			if (location.startsWith(locationSource)) return true;
		}
		
		return false;
	}
	
	public Object map(String location) {
		return bytesFrom(location);
	}
	
}